home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1980-01-01 | 4.0 KB | 134 lines |
- 1 '**********************************
- 2 ' Adapted from the Microcomputer
- 3 ' Edition of the book
- 4 ' BASIC COMPUTER GAMES
- 5 ' Edited by David H. Ahl
- 6 '**********************************
- 7 '
- 10 CLS:KEY OFF
- 20 PRINT :PRINT TAB(18) "AWARI"
- 22 PRINT :PRINT
- 24 PRINT "Awari is an ancient African game played"
- 25 PRINT "with seven sticks and thirty-six stones"
- 26 PRINT "or beans. The board is divided into six"
- 27 PRINT "compartments or pits on each side. In"
- 28 PRINT "addition, there are two special home "
- 30 PRINT "pits at the ends.":PRINT
- 32 PRINT "A move is made by taking all of the "
- 34 PRINT "beans from any (non-empty) pit on your"
- 36 PRINT "own side (bottom) and, starting from"
- 38 PRINT "the pit to the right of this one, place one bean in each pit working around"
- 40 PRINT "the board anticlockwise.":PRINT
- 42 PRINT "A turn consists of one or two moves."
- 44 PRINT "If the last bean of your move is sown"
- 46 PRINT "in your own home you may take a second move.":PRINT
- 50 PRINT :PRINT " MORE, press enter key.";
- 51 A$=INKEY$:IF A$="" THEN 51
- 52 CLS
- 55 PRINT :PRINT TAB(18) "AWARI"
- 56 PRINT :PRINT
- 60 PRINT "If the last bean sown in a move lands"
- 62 PRINT "in an empty pit, provided that the "
- 64 PRINT "opposite pit is not empty,all the beans"
- 66 PRINT "in the opposite pit, together with the"
- 68 PRINT "last bean sown are captured and moved"
- 70 PRINT "to that player's home.":PRINT
- 74 PRINT "When either side is empty, the game is"
- 76 PRINT "finished. The player with the most "
- 77 PRINT "beans in his home has won.":PRINT
- 78 PRINT "To make a move, type in the pit's "
- 80 PRINT "number. If the last bean lands in your"
- 82 PRINT "home,the computer responds with"
- 84 PRINT "`Move again' and you then type in your"
- 86 PRINT "second move.":PRINT
- 90 PRINT "The computer always gives you the first"
- 92 PRINT "move."
- 129 PRINT :PRINT "Press any key to begin game.";
- 130 A$=INKEY$:IF A$="" THEN 130
- 135 DATA 0
- 140 DIM B(13),G(13),F(50):READ N
- 150 E=0
- 160 FOR I=0 TO 12:B(I)=3:NEXT I
- 165 C=0:F(N)=0:B(13)=0:B(6)=0
- 172 CLS
- 175 PRINT :PRINT TAB(18) "AWARI"
- 177 LOCATE 23,10:PRINT "** SCORE BOARD **"
- 178 PRINT TAB(8) "MY SIDE ";MS" YOUR SIDE ";YS;
- 179 LOCATE 25,13:PRINT "TIE GAMES ";TG;
- 180 GOSUB 510
- 182 FOR T=1 TO 1000: NEXT T
- 185 LOCATE 15,1 :PRINT " "
- 190 LOCATE 15,1:PRINT "Your move ";:GOSUB 360
- 200 IF E=0 THEN 270
- 210 IF M=H THEN GOSUB 350
- 220 IF E=0 THEN 270
- 225 LOCATE 15,1:PRINT " "
- 230 LOCATE 15,1:PRINT "My move is ";:GOSUB 670
- 240 IF E=0 THEN 270
- 250 IF M=H THEN PRINT ",";:GOSUB 670
- 260 IF E>0 THEN 180
- 270 LOCATE 17,1:PRINT "End of game."
- 280 D=B(6)-B(13):IF D<0 THEN MS=MS+1:PRINT "I win by";-D;"points.":GOTO 310
- 290 N=N+1:IF D=0 THEN PRINT "Tie game.": TG=TG+1:GOTO 310
- 300 PRINT "You win by";D;"points.":YS=YS+1
- 310 PRINT :PRINT "Play again (y/n): ";
- 320 KB$=INKEY$:IF KB$="" THEN 320
- 330 IF LEFT$(KB$,1)="n" OR LEFT$(KB$,1)="N" THEN LOAD"masterp",R
- 344 GOTO 150
- 350 LOCATE 15,1:PRINT "Move again.";
- 360 INPUT " ",M:IF M<7 AND M>0 THEN M=M-1:GOTO 380
- 370 BEEP:PRINT "Illegal move!!!":FOR TD=1 TO 1000:NEXT TD:LOCATE 16,1:PRINT " ":GOTO 350
- 380 IF B(M)=0 THEN 370
- 390 H=6: GOSUB 410
- 400 GOTO 510
- 410 K=M: GOSUB 610
- 420 E=0: IF K>6 THEN K=K-7
- 430 C=C+1: IF C<9 THEN F(N)=F(N)*6+K
- 440 FOR I=0 TO 5
- 450 IF B(I) <> 0 THEN 460 ELSE 490
- 460 FOR KB=7 TO 12
- 470 IF B(KB)<>0 THEN E=1
- 480 NEXT KB
- 490 NEXT I
- 500 RETURN
- 510 LOCATE 7,11:PRINT "MY SIDE"
- 512 LOCATE 8,1:COLOR 0,7 :PRINT "HOME 6 5 4 3 2 1":COLOR 7,0:PRINT " ";
- 520 FOR I=12 TO 7 STEP -1: GOSUB 590
- 530 NEXT I
- 540 PRINT :I=13:GOSUB 590
- 550 PRINT " ";:PRINT B(6):PRINT " ";
- 560 FOR I=0 TO 5: GOSUB 590
- 570 NEXT I
- 575 PRINT :PRINT " ";:COLOR 0,7:PRINT "1 2 3 4 5 6 HOME":COLOR 7,0
- 577 PRINT " YOUR SIDE"
- 580 PRINT :PRINT :RETURN
- 590 IF B(I)<10 THEN COLOR 7:PRINT " ";
- 600 PRINT B(I);:RETURN
- 610 P=B(M):B(M)=0
- 620 FOR P=P TO 1 STEP -1:M=M+1:IF M>13 THEN M=M-14
- 630 B(M)=B(M)+1:NEXT P
- 640 IF B(M)=1 THEN IF M<>6 THEN IF M<>13 THEN IF B(12-M)<>0 THEN 660
- 650 RETURN
- 660 B(H)=B(H)+B(12-M)+1:B(M)=0:B(12-M)=0:RETURN
- 670 D=-99:H=13
- 680 FOR I=0 TO 13:G(I)=B(I):NEXT I
- 690 FOR J=7 TO 12: IF B(J)=0 THEN 830
- 700 G=0:M=J::GOSUB 610
- 710 FOR I=0 TO 5: IF B(I)=0 THEN 760
- 720 L=B(I)+I:R=0
- 730 IF L>13 THEN L=L-14:R=1:GOTO 730
- 740 IF B(L)=0 AND L<>6 AND L<>13 THEN R=B(12-L)+R
- 750 IF R>Q THEN Q=R
- 760 NEXT I
- 770 Q=B(13)-B(6)-Q: IF C>8 THEN 810
- 780 K=J: IF K>6 THEN K=K-7
- 790 FOR I=0 TO N-1: IF F(N)*6+K=INT(F(I)/6^(7-C)+0.1) THEN Q=Q-2
- 800 NEXT I
- 810 FOR I=0 TO 13:B(I)=G(I):NEXT I
- 820 IF Q>=D THEN A=J:D=Q
- 830 NEXT J
- 840 M=A:PRINT CHR$(42+M);:GOTO 410
- 850 FOR I=0 TO N-1: PRINT B(I):NEXT I
- 860 END
- 870 IF B(M) =1 AND M<>6 AND M<>13 AND B(12-M)<>0 THEN 660
-